import { PropertyReference, LinkToCopilotCloud } from "@/components";

import { Tabs } from "nextra/components";

import { Callout } from "nextra/components";

# CopilotRuntime

<Callout type="info">
  This is the reference for the `CopilotRuntime` class. For more information and example code snippets, please see [Concept: Copilot Runtime](/concepts/copilot-runtime).
</Callout>
 
## Usage
 
```tsx
import { CopilotRuntime } from "@copilotkit/runtime";
 
const copilotKit = new CopilotRuntime();
```

## Constructor Parameters

<PropertyReference name="middleware" type="Middleware"  > 
Middleware to be used by the runtime.
 
  ```ts
  onBeforeRequest: (options: {
    threadId?: string;
    runId?: string;
    inputMessages: Message[];
    properties: any;
  }) => void | Promise<void>;
  ```
 
  ```ts
  onAfterRequest: (options: {
    threadId?: string;
    runId?: string;
    inputMessages: Message[];
    outputMessages: Message[];
    properties: any;
  }) => void | Promise<void>;
  ```
</PropertyReference>

<PropertyReference name="actions" type="ActionsConfiguration<T>"  > 
A list of server side actions that can be executed.
</PropertyReference>

<PropertyReference name="langserve" type="RemoteChainParameters[]"  > 
An array of LangServer URLs.
</PropertyReference>

